package com.ybkj.o2o.mc.common.query;

import org.apache.commons.lang.StringUtils;

import java.util.Date;

/**
 * All rights Reserved, Designed By 四川小咖科技.
 *
 * @version V1.0
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: 账户查询类
 * @author: 四川小咖科技
 * @date: ${date} ${time}
 * @Copyright: ${year} www.easymi.com . All rights reserved.
 */
public class AccountQuery {

  private Long passengerId;
  
  private Long introducerId;

  private Long departmentId;
  
  private Long enterpriseId;

  private Date startTime;

  private Date endTime;

  private Boolean negative; //小于等于0

  private Integer page;

  private Integer offset;

  private Integer rows;

  private Long companyId;
  
  private String payType;

  private String appKey;

  private String keyword;//模糊查询

  public Long getPassengerId() {
    return passengerId;
  }

  public void setPassengerId(Long passengerId) {
    this.passengerId = passengerId;
  }
  
  public Long getIntroducerId() {
    return introducerId;
  }

  public void setIntroducerId(Long introducerId) {
    this.introducerId = introducerId;
  }

  public Long getEnterpriseId() {
    return enterpriseId;
  }

  public void setEnterpriseId(Long enterpriseId) {
    this.enterpriseId = enterpriseId;
  }

  public Date getStartTime() {
    return startTime;
  }

  /**
   * 把long转换为date类型.
   */
  public void setStartTime(Long start) {

    if (null != start) {
      this.startTime = new Date(start);
    }
  }

  public Date getEndTime() {
    return endTime;
  }

  /**
   * 把long转换为date类型.
   */
  public void setEndTime(Long end) {
    if (null != end) {
      this.endTime = new Date(end);
    }
  }

  public Boolean getNegative() {
    return negative;
  }

  /**
   * 把negative字符串转换为Boolean类型.
   */
  public void setNegative(String negative) {

    if ("Negative".equals(negative)) {
      this.negative = Boolean.TRUE;
    } else if ("Positive".equals(negative)) {
      this.negative = Boolean.FALSE;
    } else {
      this.negative = null;
    }

  }

  /**
   * 根据page和rows计算出偏移量.
   */
  public Integer getOffset() {
    if (getPage() == null || getRows() == null) {
      return null;
    }
    if (getPage() > 0) {
      return (getPage() - 1) * getRows();
    }

    return offset;
  }

  public void setOffset(Integer offset) {
    this.offset = offset;
  }

  public Integer getPage() {
    return page;
  }

  public void setPage(Integer page) {
    this.page = page;
  }

  public Integer getRows() {
    return rows;
  }

  public void setRows(Integer rows) {
    this.rows = rows;
  }

  public Long getCompanyId() {
    return companyId;
  }

  public void setCompanyId(Long companyId) {
    this.companyId = companyId;
  }

  public String getPayType() {
    return payType;
  }

  public void setPayType(String payType) {
    this.payType = payType;
  }

  public String getAppKey() {
    return appKey;
  }

  public void setAppKey(String appKey) {
    this.appKey = appKey;
  }

  public String getKeyword() {
    return keyword;
  }

  /**
   * 普通字符串转换为数据库模糊查询的字符串，即两边连接'%'.
   */
  public void setKeyword(String keyword) {
    if (StringUtils.isNotBlank(keyword)) {
      this.keyword = "%" + keyword + "%";
    } else {
      this.keyword = null;
    }
  }

public Long getDepartmentId() {
	return departmentId;
}

public void setDepartmentId(Long departmentId) {
	this.departmentId = departmentId;
}
}
